import Vue from 'vue'
import Router from 'vue-router'
import AdminHomeView from '@/views/AdminHomeView'
import UserHomeView from '@/views/UserHomeView'
import Login from '@/views/Login'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path:'/',
      redirect: '/login', // 重定向到登录页面
    },
    {
      path: '/login',
      name: 'login',
      component: Login,
    },
    {
      path: '/admin/',
      name: 'adminHomeView',
      component: AdminHomeView,
      redirect: '/admin/book/info', // todo:管理员首页功能暂未实现，因此直接重定向到管理员书籍信息页面
      children: [
        {path: 'book/info', name: 'AdminBookInfo', component: () => import('@/views/Admin/AdminBookInfo')},
        {path: 'book/record', name: 'AdminBookRecord', component: () => import('@/views/Admin/AdminBookRecord')},
        {path: 'user/info', name: 'AdminUserInfo', component: () => import('@/views/Admin/AdminUserInfo')}
      ]
    },
    {
      path: '/user/',
      name: 'userHomeView',
      component: UserHomeView,
      redirect: '/user/book/info', // todo:用户首页功能暂未实现，因此直接重定向到管理员书籍信息页面
      children: [
        {path: 'book/info', name: 'UserBookInfo', component: () => import('@/views/User/UserBookInfo')},
        {path: 'book/record', name: 'UserBookRecord', component: () => import('@/views/User/UserBookRecord')},
      ]
    }
  ]
})
